//
//  UIButton+Extension.swift
//  HLwWeibo
//
//  Created by hqhxu on 16/3/3.
//  Copyright © 2016年 hqhxu. All rights reserved.
//

import UIKit

extension UIButton {
    
    // 便利构造函数 可以设置默认值 font:CGFloat = 11
    convenience init(title:String,backeImageName:String = "timeline_card_bottom_background",font:CGFloat = 11,imageName:String) {
        
        // 便利构造函数一定的调用自己的初始化方法self.init()
        self.init()
        self.setTitle(title, forState: UIControlState.Normal)
        
        titleLabel?.font = UIFont.systemFontOfSize(font)
        setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        
        setBackgroundImage(UIImage(named: backeImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(backeImageName) + _highlighted"), forState: UIControlState.Highlighted)
        
        
        
        
    }
}
